package com.wanmait.houlang.controller;

import com.wanmait.houlang.pojo.Professional;
import com.wanmait.houlang.service.ProfessionalService;
import com.wanmait.houlang.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/webContent")
public class ProfessionalController {
    @Resource
    private ProfessionalService professionalService;

    //根据学校id查询学校专业
    @GetMapping("schoolProfessional/{id:\\d+}")
    public Result searchSchoolProfessionalById(@PathVariable Integer id){
        List<Professional> professionals =professionalService.findBySchoolId(id);
        return Result.success(professionals);
    }

    //获取所有的本科专业
    @GetMapping("bachelorPro")
    public Result searchBachelorPro(){
        List<Professional> bachelorPro = professionalService.findBachelorPro();
        return Result.success(bachelorPro);
    }
    //获取所有的专科专业
    @GetMapping("juniorPro")
    public Result searchJuniorPro(){
        List<Professional> juniorPro=professionalService.findJuniorPro();
        return Result.success(juniorPro);
    }
    //根据id查询学类
    @GetMapping("majorPro/{id:\\d++}")
    public  Result Learning(@PathVariable("id") Integer majorId){
        Professional professional= professionalService.majorPro(majorId);
        return Result.success(professional);
    }
}
